/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.inventory.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author sithum
 */
@Entity
@Table(name = "ITEM_WEIGHT", catalog = "", schema = "APP")
@NamedQueries({@NamedQuery(name = "ItemWeight.findAll", query = "SELECT i FROM ItemWeight i"), @NamedQuery(name = "ItemWeight.findByWeightId", query = "SELECT i FROM ItemWeight i WHERE i.weightId = :weightId"), @NamedQuery(name = "ItemWeight.findByWeight", query = "SELECT i FROM ItemWeight i WHERE i.weight = :weight"), @NamedQuery(name = "ItemWeight.findByUnit", query = "SELECT i FROM ItemWeight i WHERE i.unit = :unit"),
    @NamedQuery(name = "ItemWeight.recordCount", query = "SELECT COUNT(i) FROM ItemWeight i")})
public class ItemWeight implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "WEIGHT_ID", nullable = false)
    private Integer weightId;
    @Column(name = "WEIGHT")
    private Integer weight;
    @Column(name = "UNIT", length = 10)
    private String unit;
    @OneToMany(mappedBy = "weightId")
    private List<Item> itemCollection;

    public ItemWeight() {
    }

    public ItemWeight(Integer weightId) {
        this.weightId = weightId;
    }

    public Integer getWeightId() {
        return weightId;
    }

    public void setWeightId(Integer weightId) {
        this.weightId = weightId;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public List<Item> getItemCollection() {
        return itemCollection;
    }

    public void setItemCollection(List<Item> itemCollection) {
        this.itemCollection = itemCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (weightId != null ? weightId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemWeight)) {
            return false;
        }
        ItemWeight other = (ItemWeight) object;
        if ((this.weightId == null && other.weightId != null) || (this.weightId != null && !this.weightId.equals(other.weightId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.inventory.entities.ItemWeight[weightId=" + weightId + "]";
    }
}
